//
//  UIImage+Utils.h
//  WNCompany
//
//  Created by gaoxin on 15/1/13.
//  Copyright (c) 2015年 SimGao. All rights reserved.
//

#import <UIKit/UIKit.h>
typedef enum {
    MGImageResizeCrop,	// analogous to UIViewContentModeScaleAspectFill, i.e. "best fit" with no space around.
    MGImageResizeCropStart,
    MGImageResizeCropEnd,
    MGImageResizeScale	// analogous to UIViewContentModeScaleAspectFit, i.e. scale down to fit, leaving space around if necessary.
} MGImageResizingMethod;


@interface UIImage (Utils)
/**
 *  等比例缩放
 **/
-(UIImage*)scaleToSize:(CGSize)size;
/**
 *  根据宽度，获取图片尺寸
 **/
- (CGSize)getScaleSizeByWidth:(CGFloat)width;
/** 
 *  把图片缩小到指定的宽度范围内为止 
 */
- (UIImage *)scaleImageWithWidth:(CGFloat)width;
/**
 *  返回一张可自由拉伸的图片
 */
+ (UIImage *)resizedImage:(UIImage *)image;
/**
 *  返回一张可自由拉伸的图片,以左上角为扩展点
 */
+ (UIImage *)resizedLeftImage:(UIImage *)image;

- (UIImage *)imageToFitSize:(CGSize)size method:(MGImageResizingMethod)resizeMethod;
- (UIImage *)imageCroppedToFitSize:(CGSize)size; // uses MGImageResizeCrop
- (UIImage *)imageScaledToFitSize:(CGSize)size; // uses MGImageResizeScale
@end
